package com.fit.beans;

import java.util.Date;

import com.fit.interfaces.Car;
import com.fit.interfaces.Driver;
import com.fit.interfaces.Employer;
import com.fit.interfaces.Reservation;
import com.fit.service.BorrowUniqueID;



public class ReservationBean implements Reservation {

	private String idOfReservation;
	private Date dateOfReservation;

	private Car car;
	private Driver driver;
	private Employer employer;
	
	
	public Date getDateOfReservation() {
		return dateOfReservation;
	}

	public String getIdOfReservation() {
		return idOfReservation;
	}

	public void setIdOfReservation(String idOfReservation) {
		this.idOfReservation = idOfReservation;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.Reservation#setDateOfReservation(java.util.Date)
	 */
	public void setDateOfReservation(Date dateOfReservation) {
		this.dateOfReservation = dateOfReservation;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.Reservation#getCar()
	 */
	public Car getCar() {
		return car;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.Reservation#setCar(com.fit.interfaces.Car)
	 */
	public void setCar(Car car) {
		this.car = car;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.Reservation#getDriver()
	 */
	public Driver getDriver() {
		return driver;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.Reservation#setDriver(com.fit.interfaces.Driver)
	 */
	public void setDriver(Driver driver) {
		this.driver = driver;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.Reservation#getEmployer()
	 */
	public Employer getEmployer() {
		return employer;
	}

	/* (non-Javadoc)
	 * @see com.fit.beans.Reservation#setEmployer(com.fit.interfaces.Employer)
	 */
	public void setEmployer(Employer employer) {
		this.employer = employer;
	}
	
	public void executeReservation(Date dateOfR,Employer employer,Driver driver,Car car){
		
		setIdOfReservation(BorrowUniqueID.getBorrowUniqueID());
		setDateOfReservation(dateOfR);
		setEmployer(employer);
		setDriver(driver);
		setCar(car);
		
		driver.getReservation().add(this);
		employer.getReservation().add(this);
		car.getReservation().add(this);
	}
	
}
